package com.chiwen.web.controller.ks;

import com.chiwen.common.annotation.Log;
import com.chiwen.common.core.controller.BaseController;
import com.chiwen.common.core.domain.AjaxResult;
import com.chiwen.common.core.domain.entity.SysPayway;
import com.chiwen.common.core.page.TableDataInfo;
import com.chiwen.common.enums.BusinessType;
import com.chiwen.common.utils.poi.ExcelUtil;
import com.chiwen.ks.domain.KsUser;
import com.chiwen.ks.service.IKsUserService;
import com.chiwen.system.domain.SysOrder;
import com.chiwen.system.mapper.SysPaywayMapper;
import com.chiwen.system.service.ISysOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 快手用户管理Controller
 * 
 * @author dipper
 * @date 2022-12-08
 */
@RestController
@RequestMapping("/ks/ksOrder")
public class KsOrderController extends BaseController
{
    @Autowired
    private ISysOrderService sysOrderService;

    @Autowired
    private SysPaywayMapper sysPaywayMapper;

    /**
     * 查询订单管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:sysorder:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysOrder sysOrder)
    {
        startPage();
        List<SysPayway> ks = sysPaywayMapper.selectSysPaywayByPlatform("KS");

        String[] platforms = new String[ks.size()];
        int i=0;
        for (SysPayway k : ks) {
            platforms[i]= k.getWayCode();
        }
        sysOrder.setPayWays(platforms);
        List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
        return getDataTable(list);
    }


//    /**
//     * 删除快手用户管理
//     */
//    @PreAuthorize("@ss.hasPermi('ks:ksUser:remove')")
//    @Log(title = "快手用户管理", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{userIds}")
//    public AjaxResult remove(@PathVariable Integer[] userIds)
//    {
//        return toAjax(sysPaywayMapper.deleteSysPaywayByWayId(userIds));
//    }
}
